package wifiunion.com.notice;

import com.google.gson.reflect.TypeToken;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import wifiunion.com.notice.entity.DatasyncEntity;
import wifiunion.com.notice.entity.DatasyncGroupEntity;
import wifiunion.com.notice.entity.DatasyncLogCountEntity;
import wifiunion.com.notice.entity.DatasyncLogEntity;
import wifiunion.com.notice.entity.DatasyncRlEntity;

/**
 * Created by Administrator on 2017/5/25.
 */

public class DataSyncModel implements DataSyncContact.Model {
    @Override
    public void loadData(String url, HashMap<String, Object> params, BaseCallBack callBack) {

    }


    /**
     * 获取数据同步对象列表
     *
     * @param params
     * @param callBack
     */
    public void getDatasynclistRequest(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_DATASYNCLIST, params, callBack,
                new TypeToken<List<DatasyncEntity>>() {
                }.getType());

    }


    /**
     * 获取数据同步分组列表
     *
     * @param params
     * @param callBack
     */
    public void getDatasyncgroupRequest(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_DATASYNC_GROUPLIST, params, callBack,
                new TypeToken<List<DatasyncGroupEntity>>() {
                }.getType());
    }


    /**
     * 添加数据同步记录
     *
     * @param params
     * @param callBack
     */
    public void addDatasyncRequest(HashMap<String, Object> params, BaseCallBack callBack) {

    }


    /**
     * 获取数据同步记录列表
     *
     * @param params
     * @param callBack
     */
    public void getDatasyncRecordRequest(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_DATASYNC_LOGLIST, params, callBack,
                new TypeToken<ArrayList<DatasyncLogEntity>>() {
                }.getType());
    }

    /**
     * 删除数据同步对象
     *
     * @param params
     * @param callBack
     */
    public void delDatasyncRequest(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_DATASYNC_DEL, params, callBack,
                new TypeToken<String>() {
                }.getType());
    }

    public void updateDatasyncTimeRequest(HashMap<String, Object> param, BaseCallBack callBack) {
        HttpUtils.HttpPostRequest_Asyn(Constants.HTTP_URL_POST_DATASYNC_UPDATETIMES, param, callBack,
                new TypeToken<String>() {
                }.getType(), false);
    }

    public void updateDatasyncModulesRequest(HashMap<String, Object> param, BaseCallBack callBack) {
        HttpUtils.HttpPostRequest_Asyn(Constants.HTTP_URL_POST_DATASYNC_UPDATEMODULES, param, callBack,
                new TypeToken<String>() {
                }.getType(), false);
    }

    public void updateDatasyncTargetRequest(HashMap<String, Object> param, BaseCallBack callBack) {
        HttpUtils.HttpPostRequest_Asyn(Constants.HTTP_URL_POST_DATASYNC_ADD, param, callBack,
                new TypeToken<String>() {
                }.getType(), false);
    }

    public void addDatasyncTimeRequest(HashMap<String, Object> param, BaseCallBack callBack) {

        HttpUtils.HttpPostRequest_Asyn(Constants.HTTP_URL_POST_DATASYNC_UPDATETIMES, param, callBack,
                new TypeToken<String>() {
                }.getType(), false);
    }

    public void addDatasyncModulesRequest(HashMap<String, Object> param, BaseCallBack callBack) {

        HttpUtils.HttpPostRequest_Asyn(Constants.HTTP_URL_POST_DATASYNC_UPDATEMODULES, param, callBack,
                new TypeToken<String>() {
                }.getType(), false);
    }

    public void addDatasyncTargetRequest(HashMap<String, Object> param, BaseCallBack callBack) {

        HttpUtils.HttpPostRequest_Asyn(Constants.HTTP_URL_POST_DATASYNC_ADD, param, callBack,
                new TypeToken<String>() {
                }.getType(), false);
    }

    public void copyDatasyncRequest(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_DATASYNC_COPY, params, callBack,
                new TypeToken<String>() {
                }.getType());
    }

    public void addDatasyncGroupRequest(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpPostRequest_Asyn(Constants.HTTP_URL_POST_DATASYNC_ADDGROUP, params, callBack,
                new TypeToken<String>() {
                }.getType(), false);
    }

    public void getDatasyncGrouplistRequest(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_DATASYNC_GROUPLIST, params, callBack,
                new TypeToken<ArrayList<DatasyncGroupEntity>>() {
                }.getType());
    }

    public void delDatasyncGroupRequest(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_DATASYNC_DELGROUP, params, callBack,
                new TypeToken<String>() {
                }.getType());
    }


    public void addDatasyncGroupMemberRequest(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpPostRequest_Asyn(Constants.HTTP_URL_POST_DATASYNC_ADDRELGROUP, params, callBack,
                new TypeToken<String>() {
                }.getType(), false);
    }

    public void datasyncRightNowRequest(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_DATASYNC_RIGHTNOW, params, callBack,
                new TypeToken<String>() {
                }.getType());
    }

    private void datasyncRecordListRequest(HashMap<String, Object> params, BaseCallBack callBack) {

        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_DATASYNC_LOGLIST, params, callBack,
                new TypeToken<ArrayList<DatasyncLogEntity>>() {
                }.getType());
    }

    public void getDatasyncRecordCountRequest(HashMap<String, Object> params, BaseCallBack callBack) {

        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_DATASYNC_LOGCOUNT, params, callBack,
                new TypeToken<DatasyncLogCountEntity>() {
                }.getType());
    }

    public void getRelGroupList(HashMap<String, Object> params,  BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_DATASYNC_RLGROUPLIST, params, callBack,
                new TypeToken<ArrayList<DatasyncGroupEntity>>() {
                }.getType());
    }

    public void getRelGroupMemberList(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_DATASYNC_GROUP_TASK, params, callBack,
                new TypeToken<ArrayList<DatasyncRlEntity>>() {
                }.getType());
    }
}
